/**
 * 返回初始医院选择界面
 */
function caseSelectionVote() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote";
}

function castVote() {
    $.ajax({
        url: Feng.ctxPath + "/caseSelectionVote/castVote",
        type: "post",
        data: {
            "id": document.getElementById("id").value,
        },
        dataType: "json",
        success: function (data) {
                if(data==1){
                    document.getElementById("countVotes").value==1;
                    alert("每份病例1天最多只能投票一次！");
                } else if(data==5){
                    document.getElementById("countVotes").value==5;
                    alert("每天投票不能超过5次！");
                } else {
                    document.getElementById("countVotes").value==1;
                    alert("投票成功！");
                }
            $("#castVoteAble").hide();
            $("#castVoteDisable").show();
        },
        error: function (data) {
            alert('投票失败!');
        }
    });
}

function castVoteDisable() {
    var countVotes =document.getElementById("countVotes").value;
    if(countVotes==1){
        alert("每份病例1天最多只能投票一次！");
    } else if(countVotes==5){
        alert("每天投票不能超过5次！");
    } else{
        alert("每份病例1天最多只能投票一次,每天投票不能超过5次！");
    }
}

/**
 * 点击查看该医院所有病例
 */
function viewCaseSet(obj) {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/scoreViewCases/" + obj;
}

/**
 * 点击查看医院提交病例详情
 */
function caseScoring(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/caseScoring/" + fullObj;
}

/**
 * 点击查看患者信息
 */
function patientInformation(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/patientInformation/" + fullObj;
}

/**
 * 点击查看临床病例
 */
function clinicalCase(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/clinicalCase/" + fullObj;
}

/**
 * 点击查看辅助检查
 */
function supplementary(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/supplementary/" + fullObj;
}

/**
 * 点击查看治疗计划
 */
function treatmentDesign(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/treatmentDesign/" + fullObj;
}

/**
 * 点击查看治疗步骤
 */
function treatmentStepsDetails(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/treatmentStepsDetails/" + fullObj;
}

/**
 * 点击查看术后跟踪
 */
function postoperative(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/postoperative/" + fullObj;
}

/**
 * 显示活动详情
 */
function displayDetails(obj) {
    $("#activityDetails").toggle();
    $(obj).children('span').toggle();
}

/**
 * 跳转到规则详情
 */
function ruleDetails() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/ruleDetails";
}

/**
 * 跳转到排名统计
 */
function rankingStatistics() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/rankingStatistics";
}

/**
 * 跳转到选手搜索
 */
function searchPlayer() {
    var index = layer.open({
        type: 2,
        title: '添加预约客户',
        area: ['60%', '30%'], //宽高
        fix: true, //不固定
        maxmin: true,
        content: Feng.ctxPath + "/caseSelectionVote/searchPlayer"
    });
    this.layerIndex = index;
}

/**
 * 跳转到选手详情
 */
function enterDetails(obj) {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/enterDetails/" + obj;
}

/**
 * 点击搜索按钮跳转到选手详情
 */
$("#searchPlayer").click(function () {  //首页搜索
    var obj = $("#playerIds").val();
    window.location.href = Feng.ctxPath + "/caseSelectionVote/enterDetails/" + obj;
});

$("#searchPlayers").click(function () { //弹出框搜索
    var obj = $("#playerIds").val();
    window.parent.location.href = Feng.ctxPath + "/caseSelectionVote/enterDetails/" + obj;
});